/**

 @Name: 案例

 */
 
layui.define(['laypage', 'fly'], function(exports){

  let sw={
      /**
       * 条数据模板
       * @param res
       * @returns {string}
       */
      dataToHtml:function(resAttr) {
        /* var resAttr = {
             'resguid': 'r1',//资源的guid
             'userguid': 'u1',//用户的guid
             'name': '孙武',//资源拥有者姓名
             'level': 'VIP0',//用户等级
             'cover': 'img_url',//用户头像
             'title': '资源名称',//资源名称
             'catname': 'sjdflsd',//资源所属分类名称
             'createTime': '23234',//资源创建时间`
             'price': '2',//资源价格
             'downloads': '222',//下载量,
             'comments': '33'//评论量
         };*/
        //资源模板
        return resTpl = ` <li>
                        <a href="{:url('home/user/userdetail')}?guid=${resAttr.userguid}"
                           class="fly-avatar">
                            <img src="__PUBLIC__/${resAttr.cover}"
                                 alt=".">
                        </a>
                        <h2>
                            <a class="layui-badge">${resAttr.catname}</a>
                            <a href="{:url('home/index/detail')}?guid=${resAttr.resguid}">${resAttr.title}</a>
                        </h2>
                        <div class="fly-list-info">
                            <a href="{:url('home/user/userdetail',['guid'=>$data['user']['PK_UserGuid']])}" link>
                                <cite>${resAttr.name}</cite>
                                <i class="layui-badge fly-badge-vip">${resAttr.level}</i>
                            </a>
                            <span>${resAttr.createTime}</span>

                            <span title="所需金币"><img src="__IMG__/goldIcon.png"
                                                    class="sw-money-icon">${resAttr.price}</span>
                            <span class="layui-badge fly-badge-accept layui-hide-xs"
                                  title="下载量">${resAttr.downloads}</span>
                            <span class="fly-list-nums">
                <i class="iconfont icon-pinglun1" title="评论"></i>${resAttr.comments}
              </span>
                        </div>
                        <div class="fly-list-badge">
                            <!--
                            <span class="layui-badge layui-bg-black">置顶</span>
                            <span class="layui-badge layui-bg-red">精帖</span>
                            -->
                        </div>
                    </li>`;

    }
  }
  exports('sw', sw);
});